<!DOCTYPE html>
<!--suppress ThymeleafVariablesResolveInspection-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all" />
    <script th:src="@{/assets/plugins/jquery/jquery-3.1.0.min.js}"></script>
    <script th:src="@{/layui/layui.js}"></script>
</head>
<style>
    ::-webkit-scrollbar {display:none}
</style>
<body>
<form class="layui-form">
    <ul class="menu">
        <input type="hidden" th:value="${emp.emp_id}" name="emp_id">
        <input type="hidden" th:value="${emp.dep_id}" name="dep_id">
        <li>
            <label class="layui-form-label" style="width: 200px; text-align: left">本周情况描述：</label>
            <textarea name="weekcur" required lay-verify="required" class="layui-textarea"></textarea>
        </li>

        <li>
            <label class="layui-form-label" style="width: 200px; text-align: left">问题学生情况反馈：</label>
            <textarea name="studentquestion" required lay-verify="required" class="layui-textarea"></textarea>
        </li>

        <li>
            <label class="layui-form-label" style="width: 200px; text-align: left">意见建议：</label>
            <textarea name="idea" required lay-verify="required" class="layui-textarea"></textarea>
        </li>

        <li>
            <label class="layui-form-label" style="width: 200px; text-align: left">下周工作计划：</label>
            <textarea name="weeknext" required lay-verify="required" class="layui-textarea"></textarea>
        </li>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <center>
                    <button class="layui-btn" onclick="ok()" lay-submit lay-filter="formDemo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
                </center>
            </div>
        </div>

    </ul>
</form>
</body>
<script type="text/javascript">
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        //你可以在这里做操作  也可以不使用这个方法
        form.on('submit(formDemo)', function(data){

            $.ajax({
                url: '/workdiary/addwork',
                type: 'post',
                data:data.field,
                dataType: 'json',
                success:function(data){
                    if(data){
                        layer.msg(JSON.stringify("添加成功"));
                        //先得到当前iframe层的索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //再执行关闭
                        parent.layer.close(index);
                        window.parent.location.reload();
                    }else {
                        layer.msg('本周周报已完成', { icon: 5, time: 2000 });
                    }
                },
            })
            //$('.layui-laypage-btn').click();//刷新
            return false;
        });
    });
</script>
</html>